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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: D = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.s: B = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: C = None
        self.t: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: D = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.s: B = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: C = None
        self.t: C = None
        self.txt = txt

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

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