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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: D = None
        self.x: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: H = None
        self.q: G = None
        self.v: F = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: D = None
        self.x: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: H = None
        self.q: G = None
        self.v: F = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

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