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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: D = None
        self.v: C = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.w: F = None
        self.u: E = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
i = C("i")
g = D("g")
j = E("j")
c = F("c")
n = A("n")
e = F("e")
a = E("a")

k.u = n
m.q = e
m.r = g
m.s = g
m.v = i
i.v = c
i.u = m
i.o = m
i.x = g
i.z = g
g.p = j
g.t = j
g.w = e
g.u = a
j.s = c
c.q = m
c.x = i
n.u = k
e.q = m
e.x = i
a.s = c
assert n.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: D = None
        self.v: C = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.w: F = None
        self.u: E = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
i = C("i")
g = D("g")
j = E("j")
c = F("c")
n = A("n")
e = F("e")
a = E("a")

k.u = n
m.q = e
m.r = g
m.s = g
m.v = i
i.v = c
i.u = m
i.o = m
i.x = g
i.z = g
g.p = j
g.t = j
g.w = e
g.u = a
j.s = c
c.q = m
c.x = i
n.u = k
e.q = m
e.x = i
a.s = c
assert n.u.u.u.u.u.txt == "k"