class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: E = None
        self.z: F = None
        self.p: B = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: C = None
        self.q: E = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.r: D = None
        self.txt = txt

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

a = A("a")
e = B("e")
g = C("g")
d = D("d")
c = E("c")
h = F("h")

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: C = None
        self.q: E = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.r: D = None
        self.txt = txt

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

a = A("a")
e = B("e")
g = C("g")
d = D("d")
c = E("c")
h = F("h")

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