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

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

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

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

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

l.v = a
e.t = c
e.y = h
b.p = c
b.z = a
b.o = a
c.r = b
n.v = a
h.t = c
h.y = e
j.v = a
a.p = c
a.z = b
a.o = b
assert n.v.o.o.p.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

l.v = a
e.t = c
e.y = h
b.p = c
b.z = a
b.o = a
c.r = b
n.v = a
h.t = c
h.y = e
j.v = a
a.p = c
a.z = b
a.o = b
assert n.v.o.o.p.r.o.txt == "a"