class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

g = A("g")
i = B("i")
h = C("h")
l = D("l")
d = E("d")
e = F("e")
j = B("j")
n = A("n")
m = D("m")
f = A("f")

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

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

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

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

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

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

g = A("g")
i = B("i")
h = C("h")
l = D("l")
d = E("d")
e = F("e")
j = B("j")
n = A("n")
m = D("m")
f = A("f")

g.q = h
g.y = n
g.r = j
i.t = h
h.p = g
h.r = d
l.p = m
l.z = m
l.t = h
l.v = g
l.o = f
d.r = e
d.v = l
e.q = d
j.t = h
n.q = h
n.y = g
n.r = j
m.p = l
m.z = l
m.t = h
m.v = g
m.o = n
f.q = h
f.y = n
f.r = j
assert m.v.q.p.q.txt == "h"