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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l = A("l")
m = B("m")
g = C("g")
h = D("h")
c = E("c")
e = B("e")
f = D("f")

l.s = f
m.o = c
m.p = c
m.u = c
m.v = f
m.q = l
g.z = c
g.y = c
g.r = l
h.w = l
h.r = g
h.p = g
c.t = g
c.o = g
c.r = f
c.u = l
c.p = l
e.o = c
e.p = c
e.u = c
e.v = f
e.q = l
f.w = l
f.r = g
f.p = g
assert m.o.o.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l = A("l")
m = B("m")
g = C("g")
h = D("h")
c = E("c")
e = B("e")
f = D("f")

l.s = f
m.o = c
m.p = c
m.u = c
m.v = f
m.q = l
g.z = c
g.y = c
g.r = l
h.w = l
h.r = g
h.p = g
c.t = g
c.o = g
c.r = f
c.u = l
c.p = l
e.o = c
e.p = c
e.u = c
e.v = f
e.q = l
f.w = l
f.r = g
f.p = g
assert m.o.o.z.p.txt == "l"