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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: F = None
        self.x: D = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: G = None
        self.w: C = None
        self.o: C = None
        self.t: F = None
        self.txt = txt

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

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

l = A("l")
n = B("n")
g = C("g")
j = D("j")
h = E("h")
b = F("b")
f = G("f")
k = C("k")
m = F("m")

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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: F = None
        self.x: D = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: G = None
        self.w: C = None
        self.o: C = None
        self.t: F = None
        self.txt = txt

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

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

l = A("l")
n = B("n")
g = C("g")
j = D("j")
h = E("h")
b = F("b")
f = G("f")
k = C("k")
m = F("m")

l.q = n
l.t = n
l.r = f
n.o = f
n.s = b
n.x = j
n.p = j
g.x = h
g.r = b
g.v = f
j.u = l
j.t = n
h.q = l
h.p = f
h.w = g
h.o = k
h.t = b
b.p = k
b.u = m
b.t = m
b.o = m
b.x = j
f.o = n
f.p = h
k.x = h
k.r = b
k.v = f
m.p = g
m.u = b
m.t = b
m.o = b
m.x = j
assert m.u.x.u.txt == "l"