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

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

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

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

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

h.v = b
h.t = n
a.v = n
e.u = j
e.w = g
e.r = f
e.p = f
b.v = g
b.x = h
b.w = h
n.v = g
f.u = c
f.w = k
f.r = e
f.p = e
g.v = k
k.v = a
j.v = n
j.x = h
j.w = h
c.v = g
c.x = h
c.w = h
assert h.t.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

h.v = b
h.t = n
a.v = n
e.u = j
e.w = g
e.r = f
e.p = f
b.v = g
b.x = h
b.w = h
n.v = g
f.u = c
f.w = k
f.r = e
f.p = e
g.v = k
k.v = a
j.v = n
j.x = h
j.w = h
c.v = g
c.x = h
c.w = h
assert h.t.v.v.v.v.txt == "n"