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

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

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

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

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

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

d = A("d")
b = B("b")
l = C("l")
k = D("k")
m = E("m")
i = F("i")
c = E("c")
h = B("h")

d.v = b
d.z = l
b.q = c
l.x = d
k.p = l
k.w = l
k.r = b
k.z = i
m.t = c
i.q = d
i.v = c
i.w = k
i.u = k
c.t = m
h.q = m
assert m.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

d = A("d")
b = B("b")
l = C("l")
k = D("k")
m = E("m")
i = F("i")
c = E("c")
h = B("h")

d.v = b
d.z = l
b.q = c
l.x = d
k.p = l
k.w = l
k.r = b
k.z = i
m.t = c
i.q = d
i.v = c
i.w = k
i.u = k
c.t = m
h.q = m
assert m.t.t.t.t.t.t.txt == "m"