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

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

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

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

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

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

a = A("a")
h = B("h")
n = C("n")
m = D("m")
j = E("j")
f = F("f")
l = E("l")
k = B("k")

a.v = m
h.q = k
n.q = a
n.u = a
n.p = j
n.r = l
n.z = h
m.o = a
j.z = m
j.r = m
j.q = h
f.v = n
f.o = a
f.x = a
f.p = m
f.r = m
f.y = j
l.z = m
l.r = m
l.q = k
k.q = h
assert l.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

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

a = A("a")
h = B("h")
n = C("n")
m = D("m")
j = E("j")
f = F("f")
l = E("l")
k = B("k")

a.v = m
h.q = k
n.q = a
n.u = a
n.p = j
n.r = l
n.z = h
m.o = a
j.z = m
j.r = m
j.q = h
f.v = n
f.o = a
f.x = a
f.p = m
f.r = m
f.y = j
l.z = m
l.r = m
l.q = k
k.q = h
assert l.q.q.q.q.q.txt == "k"