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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: 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.r: A = None
        self.u: B = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

f = A("f")
l = B("l")
b = C("b")
h = D("h")
k = D("k")
d = C("d")
c = D("c")
a = B("a")

f.w = b
l.t = f
l.p = a
b.t = a
h.r = f
h.s = f
h.u = a
h.x = d
k.r = f
k.s = f
k.u = a
k.x = d
d.t = l
c.r = f
c.s = f
c.u = a
c.x = d
a.t = f
a.p = l
assert a.t.w.t.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: 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.r: A = None
        self.u: B = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

f = A("f")
l = B("l")
b = C("b")
h = D("h")
k = D("k")
d = C("d")
c = D("c")
a = B("a")

f.w = b
l.t = f
l.p = a
b.t = a
h.r = f
h.s = f
h.u = a
h.x = d
k.r = f
k.s = f
k.u = a
k.x = d
d.t = l
c.r = f
c.s = f
c.u = a
c.x = d
a.t = f
a.p = l
assert a.t.w.t.p.p.txt == "a"