class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: B = None
        self.q: G = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: G = None
        self.o: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.o: D = None
        self.u: B = None
        self.z: E = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: A = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.txt = txt

l = A("l")
a = B("a")
b = C("b")
h = D("h")
f = E("f")
c = F("c")
i = G("i")

l.y = i
l.q = i
l.r = a
l.t = c
a.y = h
a.q = i
a.o = c
a.x = b
b.x = c
b.q = l
b.o = h
b.u = a
b.z = f
b.s = f
h.q = b
h.u = b
f.x = l
f.p = l
f.s = a
c.y = b
c.p = b
c.r = f
i.y = b
i.x = c
assert h.u.o.u.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: B = None
        self.q: G = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: G = None
        self.o: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.o: D = None
        self.u: B = None
        self.z: E = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: A = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.txt = txt

l = A("l")
a = B("a")
b = C("b")
h = D("h")
f = E("f")
c = F("c")
i = G("i")

l.y = i
l.q = i
l.r = a
l.t = c
a.y = h
a.q = i
a.o = c
a.x = b
b.x = c
b.q = l
b.o = h
b.u = a
b.z = f
b.s = f
h.q = b
h.u = b
f.x = l
f.p = l
f.s = a
c.y = b
c.p = b
c.r = f
i.y = b
i.x = c
assert h.u.o.u.x.p.x.txt == "c"