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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: B = None
        self.q: C = None
        self.w: D = None
        self.txt = txt

c = A("c")
f = B("f")
d = C("d")
h = D("h")
m = C("m")
e = A("e")
a = D("a")
b = B("b")
n = D("n")
g = B("g")

c.w = e
c.r = n
f.x = c
f.o = c
f.u = c
f.p = b
d.t = m
d.s = a
d.o = n
h.o = e
h.z = g
h.q = m
h.w = n
m.t = d
m.s = a
m.o = n
e.w = c
e.r = n
a.o = e
a.z = g
a.q = d
a.w = h
b.x = e
b.o = c
b.u = c
b.p = g
n.o = c
n.z = b
n.q = d
n.w = h
g.x = e
g.o = c
g.u = c
g.p = f
assert g.p.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: B = None
        self.q: C = None
        self.w: D = None
        self.txt = txt

c = A("c")
f = B("f")
d = C("d")
h = D("h")
m = C("m")
e = A("e")
a = D("a")
b = B("b")
n = D("n")
g = B("g")

c.w = e
c.r = n
f.x = c
f.o = c
f.u = c
f.p = b
d.t = m
d.s = a
d.o = n
h.o = e
h.z = g
h.q = m
h.w = n
m.t = d
m.s = a
m.o = n
e.w = c
e.r = n
a.o = e
a.z = g
a.q = d
a.w = h
b.x = e
b.o = c
b.u = c
b.p = g
n.o = c
n.z = b
n.q = d
n.w = h
g.x = e
g.o = c
g.u = c
g.p = f
assert g.p.p.p.u.txt == "c"