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

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

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

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

j = A("j")
k = B("k")
c = C("c")
n = D("n")
b = C("b")
g = B("g")
f = B("f")
h = A("h")
a = D("a")

j.u = h
j.o = n
j.t = b
k.y = f
k.u = f
k.o = n
c.v = n
c.z = n
c.y = b
c.q = h
n.x = a
n.y = k
n.r = h
b.v = a
b.z = a
b.y = c
b.q = h
g.y = k
g.u = k
g.o = n
f.y = k
f.u = g
f.o = n
h.u = j
h.o = n
h.t = c
a.x = n
a.y = k
a.r = j
assert c.z.r.t.q.u.o.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: D = None
        self.t: C = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
c = C("c")
n = D("n")
b = C("b")
g = B("g")
f = B("f")
h = A("h")
a = D("a")

j.u = h
j.o = n
j.t = b
k.y = f
k.u = f
k.o = n
c.v = n
c.z = n
c.y = b
c.q = h
n.x = a
n.y = k
n.r = h
b.v = a
b.z = a
b.y = c
b.q = h
g.y = k
g.u = k
g.o = n
f.y = k
f.u = g
f.o = n
h.u = j
h.o = n
h.t = c
a.x = n
a.y = k
a.r = j
assert c.z.r.t.q.u.o.x.r.txt == "j"