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

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

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

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

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

h = A("h")
g = B("g")
n = C("n")
i = D("i")
c = E("c")
l = D("l")
b = D("b")
k = A("k")
j = E("j")

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

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

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

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

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

h = A("h")
g = B("g")
n = C("n")
i = D("i")
c = E("c")
l = D("l")
b = D("b")
k = A("k")
j = E("j")

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