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

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

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

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

f = A("f")
a = B("a")
h = C("h")
d = D("d")
c = B("c")
g = B("g")
i = D("i")
l = B("l")

f.o = h
f.p = a
f.q = l
f.x = g
a.u = f
a.y = g
a.w = d
h.o = l
h.t = d
h.r = d
h.v = d
d.z = g
c.u = f
c.y = a
c.w = d
g.u = f
g.y = l
g.w = i
i.z = l
l.u = f
l.y = a
l.w = i
assert g.w.z.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: B = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
h = C("h")
d = D("d")
c = B("c")
g = B("g")
i = D("i")
l = B("l")

f.o = h
f.p = a
f.q = l
f.x = g
a.u = f
a.y = g
a.w = d
h.o = l
h.t = d
h.r = d
h.v = d
d.z = g
c.u = f
c.y = a
c.w = d
g.u = f
g.y = l
g.w = i
i.z = l
l.u = f
l.y = a
l.w = i
assert g.w.z.u.p.txt == "a"