class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: B = None
        self.u: B = None
        self.txt = txt

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

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

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

e = A("e")
l = B("l")
c = C("c")
h = D("h")
b = B("b")

e.p = c
e.v = l
e.u = b
l.o = h
c.p = b
c.x = b
c.r = h
h.u = b
h.r = e
h.z = e
b.o = h
assert e.v.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: B = None
        self.u: B = None
        self.txt = txt

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

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

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

e = A("e")
l = B("l")
c = C("c")
h = D("h")
b = B("b")

e.p = c
e.v = l
e.u = b
l.o = h
c.p = b
c.x = b
c.r = h
h.u = b
h.r = e
h.z = e
b.o = h
assert e.v.o.u.o.txt == "h"