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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.o: C = None
        self.y: C = None
        self.x: D = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: D = None
        self.w: G = None
        self.txt = txt

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

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

m.q = b
f.v = i
f.t = b
f.o = m
n.u = f
n.p = b
n.w = b
n.r = e
n.y = m
n.v = m
n.t = d
d.s = n
d.x = b
b.q = f
b.s = f
b.z = d
b.x = d
b.v = d
b.o = n
b.y = n
i.r = f
i.v = d
i.w = e
e.o = m
e.w = m
e.y = d
assert e.y.x.y.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.o: C = None
        self.y: C = None
        self.x: D = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: D = None
        self.w: G = None
        self.txt = txt

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

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

m.q = b
f.v = i
f.t = b
f.o = m
n.u = f
n.p = b
n.w = b
n.r = e
n.y = m
n.v = m
n.t = d
d.s = n
d.x = b
b.q = f
b.s = f
b.z = d
b.x = d
b.v = d
b.o = n
b.y = n
i.r = f
i.v = d
i.w = e
e.o = m
e.w = m
e.y = d
assert e.y.x.y.p.x.txt == "d"