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

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
f = C("f")
j = D("j")
e = E("e")
m = F("m")
l = G("l")
b = C("b")

d.q = l
d.y = l
d.o = m
d.u = j
i.x = e
i.q = j
f.u = l
j.p = b
e.o = d
m.t = e
m.w = l
l.o = m
l.w = d
l.x = e
l.v = e
b.u = l
assert l.w.u.p.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: F = None
        self.y: G = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
f = C("f")
j = D("j")
e = E("e")
m = F("m")
l = G("l")
b = C("b")

d.q = l
d.y = l
d.o = m
d.u = j
i.x = e
i.q = j
f.u = l
j.p = b
e.o = d
m.t = e
m.w = l
l.o = m
l.w = d
l.x = e
l.v = e
b.u = l
assert l.w.u.p.u.v.txt == "e"