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

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

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

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

l = A("l")
j = B("j")
d = C("d")
c = D("c")
f = C("f")
m = D("m")
i = B("i")
e = B("e")

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

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

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

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

l = A("l")
j = B("j")
d = C("d")
c = D("c")
f = C("f")
m = D("m")
i = B("i")
e = B("e")

l.p = m
l.x = m
j.x = i
j.w = d
j.t = f
d.t = c
c.q = j
c.v = m
f.t = m
m.q = j
m.v = c
i.x = j
i.w = f
i.t = d
e.x = i
e.w = d
e.t = d
assert i.w.t.v.txt == "c"