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

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

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
f = D("f")
g = E("g")
i = F("i")
a = C("a")
m = D("m")
b = A("b")

d.s = k
d.p = n
k.y = n
k.q = i
n.x = k
n.t = i
f.t = n
f.y = m
f.o = d
f.v = d
f.z = k
f.q = i
g.y = k
i.y = k
a.x = k
a.t = i
m.t = n
m.y = f
m.o = b
m.v = d
m.z = k
m.q = i
b.s = k
b.p = a
assert a.x.y.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
f = D("f")
g = E("g")
i = F("i")
a = C("a")
m = D("m")
b = A("b")

d.s = k
d.p = n
k.y = n
k.q = i
n.x = k
n.t = i
f.t = n
f.y = m
f.o = d
f.v = d
f.z = k
f.q = i
g.y = k
i.y = k
a.x = k
a.t = i
m.t = n
m.y = f
m.o = b
m.v = d
m.z = k
m.q = i
b.s = k
b.p = a
assert a.x.y.x.q.txt == "i"