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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.p: A = None
        self.t: F = None
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.o: C = None
        self.s: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.p: A = None
        self.t: F = None
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.o: C = None
        self.s: D = None
        self.txt = txt

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

f.q = h
f.o = j
d.y = n
d.x = n
d.s = j
d.p = h
d.t = k
j.t = n
j.p = n
j.x = k
n.o = j
b.r = k
k.z = n
k.x = n
k.s = n
k.o = j
h.q = f
h.o = j
m.z = n
m.x = n
m.s = n
m.o = j
a.r = k
assert m.x.o.x.o.txt == "j"