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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
b = C("b")
i = D("i")
g = E("g")
e = F("e")

h.x = l
l.t = g
b.u = h
b.o = i
b.y = i
b.z = e
b.x = g
b.s = l
i.t = b
g.x = i
e.z = l
e.p = l
e.u = b
e.y = g
e.x = h
assert i.t.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
b = C("b")
i = D("i")
g = E("g")
e = F("e")

h.x = l
l.t = g
b.u = h
b.o = i
b.y = i
b.z = e
b.x = g
b.s = l
i.t = b
g.x = i
e.z = l
e.p = l
e.u = b
e.y = g
e.x = h
assert i.t.u.x.txt == "l"