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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

h = A("h")
e = B("e")
c = C("c")
g = D("g")
l = E("l")
k = F("k")
m = G("m")
i = F("i")
n = A("n")
f = A("f")

h.v = f
e.t = i
e.s = g
e.u = n
e.p = l
c.z = k
g.o = c
g.v = n
l.s = k
l.y = f
k.r = e
m.q = e
m.t = g
m.o = i
i.r = e
n.v = h
f.v = h
assert h.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

h = A("h")
e = B("e")
c = C("c")
g = D("g")
l = E("l")
k = F("k")
m = G("m")
i = F("i")
n = A("n")
f = A("f")

h.v = f
e.t = i
e.s = g
e.u = n
e.p = l
c.z = k
g.o = c
g.v = n
l.s = k
l.y = f
k.r = e
m.q = e
m.t = g
m.o = i
i.r = e
n.v = h
f.v = h
assert h.v.v.v.v.txt == "h"