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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: B = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

d = A("d")
c = B("c")
g = C("g")
j = D("j")
k = B("k")
e = A("e")
l = C("l")
f = A("f")
a = C("a")

d.q = k
c.y = e
c.t = k
c.w = l
c.q = a
g.u = j
j.y = d
j.w = d
j.s = c
j.v = g
k.y = f
k.t = c
k.w = a
k.q = a
e.q = c
l.u = j
f.q = c
a.u = j
assert f.q.w.u.y.q.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: B = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

d = A("d")
c = B("c")
g = C("g")
j = D("j")
k = B("k")
e = A("e")
l = C("l")
f = A("f")
a = C("a")

d.q = k
c.y = e
c.t = k
c.w = l
c.q = a
g.u = j
j.y = d
j.w = d
j.s = c
j.v = g
k.y = f
k.t = c
k.w = a
k.q = a
e.q = c
l.u = j
f.q = c
a.u = j
assert f.q.w.u.y.q.y.q.y.txt == "e"