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

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

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

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

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

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

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

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

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

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

e.t = l
e.y = c
e.o = h
e.u = m
g.u = l
g.q = c
g.w = c
m.p = e
m.s = a
m.w = b
c.q = e
c.r = m
c.v = a
a.u = n
a.q = l
a.w = l
b.t = l
b.y = l
b.o = h
b.u = m
n.q = b
n.r = m
n.v = g
l.q = b
l.r = m
l.v = g
h.t = n
h.y = n
h.o = b
h.u = m
assert g.u.q.u.w.o.txt == "h"