class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: G = None
        self.v: C = None
        self.q: G = None
        self.s: E = None
        self.p: C = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.z: D = None
        self.r: A = None
        self.o: G = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.z: C = None
        self.p: E = None
        self.txt = txt

b = A("b")
c = B("c")
a = C("a")
h = D("h")
d = E("d")
f = F("f")
g = G("g")
k = B("k")

b.t = a
c.o = g
c.z = h
a.t = d
a.q = b
h.w = b
h.z = g
h.q = g
h.v = a
h.p = a
h.s = d
h.u = d
d.u = b
d.r = b
d.x = k
d.z = h
d.o = g
d.p = g
f.y = a
f.u = a
f.z = b
g.x = b
g.u = d
g.p = d
g.z = a
k.o = g
k.z = h
assert b.t.t.p.x.t.t.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: G = None
        self.v: C = None
        self.q: G = None
        self.s: E = None
        self.p: C = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.z: D = None
        self.r: A = None
        self.o: G = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.z: C = None
        self.p: E = None
        self.txt = txt

b = A("b")
c = B("c")
a = C("a")
h = D("h")
d = E("d")
f = F("f")
g = G("g")
k = B("k")

b.t = a
c.o = g
c.z = h
a.t = d
a.q = b
h.w = b
h.z = g
h.q = g
h.v = a
h.p = a
h.s = d
h.u = d
d.u = b
d.r = b
d.x = k
d.z = h
d.o = g
d.p = g
f.y = a
f.u = a
f.z = b
g.x = b
g.u = d
g.p = d
g.z = a
k.o = g
k.z = h
assert b.t.t.p.x.t.t.z.w.txt == "b"