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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: E = None
        self.y: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

a = A("a")
j = B("j")
k = C("k")
e = D("e")
n = E("n")
c = F("c")
h = G("h")
l = D("l")

a.r = j
a.t = j
a.x = e
a.o = h
a.q = l
j.y = n
k.p = e
k.q = n
k.y = n
k.t = n
e.v = h
n.o = a
n.q = a
c.o = a
h.z = j
h.r = k
h.v = a
l.v = h
assert a.o.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: D = None
        self.o: G = None
        self.q: D = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: E = None
        self.y: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

a = A("a")
j = B("j")
k = C("k")
e = D("e")
n = E("n")
c = F("c")
h = G("h")
l = D("l")

a.r = j
a.t = j
a.x = e
a.o = h
a.q = l
j.y = n
k.p = e
k.q = n
k.y = n
k.t = n
e.v = h
n.o = a
n.q = a
c.o = a
h.z = j
h.r = k
h.v = a
l.v = h
assert a.o.v.x.v.txt == "h"