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

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

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

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

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

i.v = h
c.u = n
c.w = j
c.v = i
a.u = n
a.p = m
f.q = m
f.t = j
g.u = h
g.p = m
j.v = c
h.u = b
h.w = i
h.v = j
m.q = f
m.t = j
n.u = b
n.w = j
n.v = i
b.u = n
b.w = j
b.v = i
assert j.v.u.u.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

i.v = h
c.u = n
c.w = j
c.v = i
a.u = n
a.p = m
f.q = m
f.t = j
g.u = h
g.p = m
j.v = c
h.u = b
h.w = i
h.v = j
m.q = f
m.t = j
n.u = b
n.w = j
n.v = i
b.u = n
b.w = j
b.v = i
assert j.v.u.u.v.v.txt == "h"