class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
g = C("g")
f = D("f")
h = D("h")

b.u = c
b.z = c
b.p = c
b.r = f
c.w = b
c.p = b
g.t = h
g.q = b
f.s = c
f.v = c
f.t = c
f.p = b
h.s = c
h.v = c
h.t = c
h.p = b
assert c.p.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
g = C("g")
f = D("f")
h = D("h")

b.u = c
b.z = c
b.p = c
b.r = f
c.w = b
c.p = b
g.t = h
g.q = b
f.s = c
f.v = c
f.t = c
f.p = b
h.s = c
h.v = c
h.t = c
h.p = b
assert c.p.p.w.txt == "b"