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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.x: C = None
        self.o: B = None
        self.txt = txt

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

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

h.t = a
h.p = d
b.w = k
b.y = k
b.q = d
b.p = h
l.y = b
l.q = k
l.o = k
l.x = f
d.z = h
f.y = b
f.q = b
f.x = l
f.o = k
k.w = b
k.y = b
k.q = a
k.p = h
a.z = h
assert a.z.p.z.t.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.x: C = None
        self.o: B = None
        self.txt = txt

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

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

h.t = a
h.p = d
b.w = k
b.y = k
b.q = d
b.p = h
l.y = b
l.q = k
l.o = k
l.x = f
d.z = h
f.y = b
f.q = b
f.x = l
f.o = k
k.w = b
k.y = b
k.q = a
k.p = h
a.z = h
assert a.z.p.z.t.z.t.txt == "a"