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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: B = None
        self.o: D = None
        self.x: A = None
        self.y: B = None
        self.v: G = None
        self.u: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
h = C("h")
n = D("n")
i = E("i")
l = F("l")
k = G("k")
m = E("m")
a = B("a")

f.q = n
f.p = l
d.x = h
d.t = h
d.v = m
d.r = k
d.q = a
h.q = l
n.w = m
i.r = n
i.u = k
l.p = k
l.v = k
l.r = a
l.y = a
l.o = n
l.x = f
l.u = h
k.p = n
k.q = n
k.u = f
m.r = n
m.u = k
a.x = h
a.t = h
a.v = i
a.r = k
a.q = d
assert m.r.w.u.p.w.r.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: B = None
        self.o: D = None
        self.x: A = None
        self.y: B = None
        self.v: G = None
        self.u: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
h = C("h")
n = D("n")
i = E("i")
l = F("l")
k = G("k")
m = E("m")
a = B("a")

f.q = n
f.p = l
d.x = h
d.t = h
d.v = m
d.r = k
d.q = a
h.q = l
n.w = m
i.r = n
i.u = k
l.p = k
l.v = k
l.r = a
l.y = a
l.o = n
l.x = f
l.u = h
k.p = n
k.q = n
k.u = f
m.r = n
m.u = k
a.x = h
a.t = h
a.v = i
a.r = k
a.q = d
assert m.r.w.u.p.w.r.w.u.txt == "k"