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

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

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

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

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

b.v = l
b.o = l
b.r = c
l.p = a
l.v = c
c.s = b
g.t = l
g.y = l
g.o = c
g.q = c
a.t = l
a.y = l
a.o = c
a.q = c
e.t = l
e.y = l
e.o = c
e.q = c
assert e.y.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.o: B = None
        self.txt = txt

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

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

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

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

b.v = l
b.o = l
b.r = c
l.p = a
l.v = c
c.s = b
g.t = l
g.y = l
g.o = c
g.q = c
a.t = l
a.y = l
a.o = c
a.q = c
e.t = l
e.y = l
e.o = c
e.q = c
assert e.y.p.t.p.t.txt == "l"