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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: B = None
        self.r: A = None
        self.y: D = None
        self.s: D = None
        self.v: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.p: A = None
        self.r: E = None
        self.v: E = None
        self.s: G = None
        self.txt = txt

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

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

b.t = c
i.r = n
c.x = f
c.v = f
c.u = i
c.r = b
c.y = n
c.s = n
n.w = k
n.v = k
n.y = k
n.s = i
k.s = b
f.q = n
f.w = c
f.p = b
f.r = k
f.v = k
f.s = h
h.r = b
h.o = i
h.v = n
h.t = f
assert h.r.t.v.q.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: B = None
        self.r: A = None
        self.y: D = None
        self.s: D = None
        self.v: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.p: A = None
        self.r: E = None
        self.v: E = None
        self.s: G = None
        self.txt = txt

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

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

b.t = c
i.r = n
c.x = f
c.v = f
c.u = i
c.r = b
c.y = n
c.s = n
n.w = k
n.v = k
n.y = k
n.s = i
k.s = b
f.q = n
f.w = c
f.p = b
f.r = k
f.v = k
f.s = h
h.r = b
h.o = i
h.v = n
h.t = f
assert h.r.t.v.q.s.r.txt == "n"