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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: F = None
        self.txt = txt

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

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

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

a.u = k
k.z = b
k.s = b
k.p = e
k.y = c
b.s = a
b.p = l
l.y = k
l.u = c
i.q = e
c.q = a
c.w = a
c.u = i
c.t = l
c.z = b
e.q = i
assert c.q.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: F = None
        self.txt = txt

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

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

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

a.u = k
k.z = b
k.s = b
k.p = e
k.y = c
b.s = a
b.p = l
l.y = k
l.u = c
i.q = e
c.q = a
c.w = a
c.u = i
c.t = l
c.z = b
e.q = i
assert c.q.u.y.u.txt == "i"