class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: D = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: B = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
i = C("i")
m = D("m")
g = E("g")
e = F("e")
n = G("n")

b.t = g
b.x = m
b.v = m
b.u = e
k.x = g
i.s = k
m.q = g
m.s = i
m.t = i
m.u = i
m.y = e
g.u = e
g.x = k
e.o = b
e.v = g
e.x = i
n.q = b
assert k.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: D = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: B = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
i = C("i")
m = D("m")
g = E("g")
e = F("e")
n = G("n")

b.t = g
b.x = m
b.v = m
b.u = e
k.x = g
i.s = k
m.q = g
m.s = i
m.t = i
m.u = i
m.y = e
g.u = e
g.x = k
e.o = b
e.v = g
e.x = i
n.q = b
assert k.x.x.x.x.txt == "k"