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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

h.o = j
h.q = f
f.w = h
k.v = e
n.y = b
n.v = j
n.w = j
n.q = k
e.z = c
b.s = j
b.o = h
c.o = n
l.z = c
j.y = b
j.v = n
j.w = n
j.q = k
assert h.o.v.y.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

h.o = j
h.q = f
f.w = h
k.v = e
n.y = b
n.v = j
n.w = j
n.q = k
e.z = c
b.s = j
b.o = h
c.o = n
l.z = c
j.y = b
j.v = n
j.w = n
j.q = k
assert h.o.v.y.s.q.txt == "k"