class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = 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.o: C = None
        self.z: A = None
        self.txt = txt

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

n = A("n")
g = B("g")
b = C("b")
a = D("a")
l = C("l")
e = B("e")
c = B("c")
k = B("k")
j = C("j")

n.t = b
n.w = k
g.q = c
b.o = l
b.z = n
a.v = l
l.o = b
l.z = n
e.q = c
c.q = e
k.q = c
j.o = l
j.z = n
assert k.q.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = 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.o: C = None
        self.z: A = None
        self.txt = txt

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

n = A("n")
g = B("g")
b = C("b")
a = D("a")
l = C("l")
e = B("e")
c = B("c")
k = B("k")
j = C("j")

n.t = b
n.w = k
g.q = c
b.o = l
b.z = n
a.v = l
l.o = b
l.z = n
e.q = c
c.q = e
k.q = c
j.o = l
j.z = n
assert k.q.q.q.q.q.q.q.txt == "c"