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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: B = None
        self.w: A = None
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: B = None
        self.t: C = None
        self.o: A = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
k = D("k")
e = B("e")
c = C("c")
d = A("d")

l.u = d
j.o = e
j.t = e
j.w = l
j.y = c
h.y = k
h.q = k
k.u = c
k.r = j
k.t = h
k.o = d
e.o = j
e.t = j
e.w = d
e.y = c
c.y = k
c.q = k
d.u = l
assert l.u.u.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.o: B = None
        self.t: B = None
        self.w: A = None
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: B = None
        self.t: C = None
        self.o: A = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
k = D("k")
e = B("e")
c = C("c")
d = A("d")

l.u = d
j.o = e
j.t = e
j.w = l
j.y = c
h.y = k
h.q = k
k.u = c
k.r = j
k.t = h
k.o = d
e.o = j
e.t = j
e.w = d
e.y = c
c.y = k
c.q = k
d.u = l
assert l.u.u.u.u.u.u.u.txt == "d"