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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: F = None
        self.s: E = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.q: F = None
        self.t: C = None
        self.x: F = None
        self.y: F = None
        self.txt = txt

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

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

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

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

d.y = a
d.t = a
d.q = n
a.p = e
a.s = e
a.y = l
a.x = l
a.r = l
n.v = d
n.x = d
n.q = b
b.p = a
b.w = a
b.q = l
b.x = l
b.y = l
b.t = n
e.u = n
e.s = d
e.o = b
l.r = b
l.w = b
l.y = e
k.q = b
i.q = b
g.q = b
assert l.y.u.q.t.q.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: F = None
        self.s: E = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.q: F = None
        self.t: C = None
        self.x: F = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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