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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.r: E = None
        self.x: A = None
        self.v: E = None
        self.t: C = None
        self.w: H = None
        self.u: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: A = None
        self.y: B = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: E = None
        self.q: A = None
        self.txt = txt

k = A("k")
n = B("n")
l = C("l")
m = D("m")
a = E("a")
g = F("g")
f = G("f")
e = H("e")

k.r = n
n.q = m
n.p = a
n.r = a
n.v = a
n.x = k
n.u = k
n.t = l
n.w = e
l.s = k
l.v = e
m.u = n
a.x = f
g.x = e
g.p = e
g.v = a
g.r = m
f.t = k
f.o = k
f.y = n
f.r = m
f.v = a
e.x = n
e.z = a
e.q = k
assert a.x.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.r: E = None
        self.x: A = None
        self.v: E = None
        self.t: C = None
        self.w: H = None
        self.u: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: A = None
        self.y: B = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: E = None
        self.q: A = None
        self.txt = txt

k = A("k")
n = B("n")
l = C("l")
m = D("m")
a = E("a")
g = F("g")
f = G("f")
e = H("e")

k.r = n
n.q = m
n.p = a
n.r = a
n.v = a
n.x = k
n.u = k
n.t = l
n.w = e
l.s = k
l.v = e
m.u = n
a.x = f
g.x = e
g.p = e
g.v = a
g.r = m
f.t = k
f.o = k
f.y = n
f.r = m
f.v = a
e.x = n
e.z = a
e.q = k
assert a.x.r.u.txt == "n"