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

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

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

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

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

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

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

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

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

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

e.x = d
e.p = l
e.v = j
j.p = c
j.z = c
j.u = d
j.r = l
l.p = d
l.r = j
c.v = j
c.s = l
c.w = l
c.p = b
d.p = c
d.z = c
d.u = j
d.r = l
b.x = d
b.p = l
b.v = j
assert b.v.r.r.r.p.txt == "d"