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

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

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

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

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

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

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

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

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

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

g.u = c
g.t = c
g.o = l
a.z = b
a.y = e
a.w = g
c.r = g
k.p = l
b.u = c
b.t = c
b.o = k
e.z = g
e.y = a
e.w = b
l.p = k
assert c.r.u.r.o.p.p.txt == "l"