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

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: A = None
        self.r: C = None
        self.u: A = None
        self.y: B = None
        self.txt = txt

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

b = A("b")
j = B("j")
m = C("m")
f = D("f")
i = E("i")
l = A("l")
c = B("c")

b.y = c
j.p = b
j.o = f
j.v = f
j.t = l
m.z = f
f.s = i
f.x = l
f.u = l
f.r = m
f.y = j
i.x = j
i.q = l
l.y = j
c.p = l
c.t = l
c.o = f
c.v = f
assert f.r.z.r.z.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: A = None
        self.r: C = None
        self.u: A = None
        self.y: B = None
        self.txt = txt

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

b = A("b")
j = B("j")
m = C("m")
f = D("f")
i = E("i")
l = A("l")
c = B("c")

b.y = c
j.p = b
j.o = f
j.v = f
j.t = l
m.z = f
f.s = i
f.x = l
f.u = l
f.r = m
f.y = j
i.x = j
i.q = l
l.y = j
c.p = l
c.t = l
c.o = f
c.v = f
assert f.r.z.r.z.r.z.r.txt == "m"