class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: G = None
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: F = None
        self.y: A = None
        self.t: A = None
        self.v: C = None
        self.u: E = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: G = None
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: F = None
        self.y: A = None
        self.t: A = None
        self.v: C = None
        self.u: E = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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