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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: G = None
        self.txt = txt

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

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

a.p = j
j.w = n
n.u = j
n.o = f
n.x = h
n.t = d
n.q = m
m.o = a
m.r = k
k.o = h
f.p = m
f.u = h
h.q = k
d.p = m
d.u = h
assert f.u.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: G = None
        self.txt = txt

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

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

a.p = j
j.w = n
n.u = j
n.o = f
n.x = h
n.t = d
n.q = m
m.o = a
m.r = k
k.o = h
f.p = m
f.u = h
h.q = k
d.p = m
d.u = h
assert f.u.q.o.txt == "h"