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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

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

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

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

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

j.q = i
i.y = f
m.p = e
m.v = e
m.u = b
m.z = b
b.t = j
b.v = f
b.u = l
b.s = l
b.y = m
l.s = j
l.w = b
l.v = m
e.o = f
e.u = m
f.o = m
assert i.y.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

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

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

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

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

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