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

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

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

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

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

l.p = c
l.s = k
d.x = l
d.w = k
j.q = k
j.v = k
j.t = d
j.p = e
k.p = d
k.o = c
c.q = k
c.v = k
c.t = d
c.p = e
e.q = k
e.v = k
e.t = d
e.p = j
assert c.p.q.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.txt = txt

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

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

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

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

l.p = c
l.s = k
d.x = l
d.w = k
j.q = k
j.v = k
j.t = d
j.p = e
k.p = d
k.o = c
c.q = k
c.v = k
c.t = d
c.p = e
e.q = k
e.v = k
e.t = d
e.p = j
assert c.p.q.p.x.txt == "l"