class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: D = None
        self.q: G = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.p: G = None
        self.q: E = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: G = None
        self.txt = txt

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

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

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

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

b.v = i
b.y = n
b.q = d
b.x = k
e.o = n
k.t = l
k.z = l
k.p = d
k.q = i
k.s = b
n.x = i
n.s = d
i.x = n
i.y = e
l.y = k
l.r = b
l.o = b
l.q = d
d.z = i
assert n.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: D = None
        self.q: G = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.p: G = None
        self.q: E = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: G = None
        self.txt = txt

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

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

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

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

b.v = i
b.y = n
b.q = d
b.x = k
e.o = n
k.t = l
k.z = l
k.p = d
k.q = i
k.s = b
n.x = i
n.s = d
i.x = n
i.y = e
l.y = k
l.r = b
l.o = b
l.q = d
d.z = i
assert n.x.x.x.x.x.txt == "i"