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

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

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

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

l = A("l")
f = B("f")
m = C("m")
a = D("a")
c = A("c")
g = C("g")
e = C("e")
b = C("b")

l.r = f
f.o = c
f.z = e
m.t = b
m.q = l
m.r = e
m.u = c
a.o = g
c.r = f
g.t = e
g.q = l
g.r = b
g.u = c
e.t = g
e.r = g
e.q = c
e.u = c
b.t = g
b.r = g
b.q = l
b.u = l
assert l.r.o.r.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
m = C("m")
a = D("a")
c = A("c")
g = C("g")
e = C("e")
b = C("b")

l.r = f
f.o = c
f.z = e
m.t = b
m.q = l
m.r = e
m.u = c
a.o = g
c.r = f
g.t = e
g.q = l
g.r = b
g.u = c
e.t = g
e.r = g
e.q = c
e.u = c
b.t = g
b.r = g
b.q = l
b.u = l
assert l.r.o.r.o.r.o.txt == "c"