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

class B:
    def __init__(self, txt: str):
        self.w: B = 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.t: B = None
        self.v: B = None
        self.r: C = None
        self.txt = txt

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

e.t = f
e.w = f
e.p = j
n.w = c
f.t = n
j.t = c
j.v = c
j.r = f
k.t = f
k.w = f
k.p = d
c.w = n
d.t = n
d.v = n
d.r = f
assert e.p.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = 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.t: B = None
        self.v: B = None
        self.r: C = None
        self.txt = txt

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

e.t = f
e.w = f
e.p = j
n.w = c
f.t = n
j.t = c
j.v = c
j.r = f
k.t = f
k.w = f
k.p = d
c.w = n
d.t = n
d.v = n
d.r = f
assert e.p.r.t.w.txt == "c"