class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: F = None
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

b = A("b")
e = B("e")
i = C("i")
c = D("c")
a = E("a")
h = F("h")

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: F = None
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

b = A("b")
e = B("e")
i = C("i")
c = D("c")
a = E("a")
h = F("h")

b.s = h
b.z = e
e.r = h
i.z = e
i.x = a
c.z = h
c.t = h
c.q = a
a.u = i
h.z = a
assert i.z.r.z.u.txt == "i"