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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.txt = txt

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

d = A("d")
c = B("c")
i = C("i")
k = D("k")
j = E("j")
a = C("a")
l = E("l")

d.p = c
d.o = i
c.w = d
i.t = c
k.v = j
k.t = d
j.v = i
j.p = k
a.t = c
l.v = i
l.p = k
assert i.t.w.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: A = None
        self.txt = txt

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

d = A("d")
c = B("c")
i = C("i")
k = D("k")
j = E("j")
a = C("a")
l = E("l")

d.p = c
d.o = i
c.w = d
i.t = c
k.v = j
k.t = d
j.v = i
j.p = k
a.t = c
l.v = i
l.p = k
assert i.t.w.o.t.txt == "c"