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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.txt = txt

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

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

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