class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.p: B = None
        self.t: A = None
        self.z: F = None
        self.o: A = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: A = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: A = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

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