class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.v: E = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: F = None
        self.r: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l.t = g
l.v = n
l.y = n
l.s = i
j.t = n
j.w = g
i.y = n
i.r = n
i.q = m
h.r = l
h.q = l
h.p = n
h.z = i
n.r = j
n.y = j
n.o = i
m.o = h
m.v = n
m.q = i
g.z = h
g.r = i
g.p = i
b.o = h
b.v = n
b.q = i
assert b.q.q.q.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.v: E = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: F = None
        self.r: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l.t = g
l.v = n
l.y = n
l.s = i
j.t = n
j.w = g
i.y = n
i.r = n
i.q = m
h.r = l
h.q = l
h.p = n
h.z = i
n.r = j
n.y = j
n.o = i
m.o = h
m.v = n
m.q = i
g.z = h
g.r = i
g.p = i
b.o = h
b.v = n
b.q = i
assert b.q.q.q.q.o.txt == "h"