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

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

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

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

n = A("n")
c = B("c")
k = C("k")
j = D("j")
d = C("d")
m = B("m")
g = A("g")
h = A("h")
a = D("a")

n.y = h
c.s = n
c.p = n
c.u = a
c.w = g
k.y = j
k.x = n
j.t = k
j.v = n
j.y = a
j.u = a
d.y = j
d.x = n
m.s = n
m.w = n
m.u = a
m.p = g
g.y = h
h.y = n
a.t = d
a.v = n
a.y = j
a.u = j
assert c.u.v.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

n = A("n")
c = B("c")
k = C("k")
j = D("j")
d = C("d")
m = B("m")
g = A("g")
h = A("h")
a = D("a")

n.y = h
c.s = n
c.p = n
c.u = a
c.w = g
k.y = j
k.x = n
j.t = k
j.v = n
j.y = a
j.u = a
d.y = j
d.x = n
m.s = n
m.w = n
m.u = a
m.p = g
g.y = h
h.y = n
a.t = d
a.v = n
a.y = j
a.u = j
assert c.u.v.y.y.y.txt == "h"