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

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

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

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

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

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

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

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

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

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

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

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

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

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

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