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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: B = None
        self.q: A = None
        self.r: D = None
        self.y: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
i = C("i")
g = D("g")
c = E("c")
k = F("k")
l = B("l")
e = D("e")

f.x = i
f.y = l
f.q = k
f.p = e
d.u = l
i.t = k
g.s = c
c.t = l
c.p = l
c.q = f
c.r = e
c.y = i
k.q = d
l.u = d
e.s = c
assert k.q.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.q: F = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: B = None
        self.q: A = None
        self.r: D = None
        self.y: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
i = C("i")
g = D("g")
c = E("c")
k = F("k")
l = B("l")
e = D("e")

f.x = i
f.y = l
f.q = k
f.p = e
d.u = l
i.t = k
g.s = c
c.t = l
c.p = l
c.q = f
c.r = e
c.y = i
k.q = d
l.u = d
e.s = c
assert k.q.u.u.u.u.u.u.txt == "d"