class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: B = None
        self.s: A = None
        self.o: A = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: D = None
        self.t: A = None
        self.txt = txt

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

m.r = d
m.s = i
k.u = e
c.r = k
c.x = k
f.r = m
f.s = m
f.o = m
f.q = m
f.x = k
f.p = d
d.q = c
i.x = c
i.t = c
e.p = k
e.s = f
e.t = m
assert i.x.r.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: B = None
        self.s: A = None
        self.o: A = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: D = None
        self.t: A = None
        self.txt = txt

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

m.r = d
m.s = i
k.u = e
c.r = k
c.x = k
f.r = m
f.s = m
f.o = m
f.q = m
f.x = k
f.p = d
d.q = c
i.x = c
i.t = c
e.p = k
e.s = f
e.t = m
assert i.x.r.u.p.txt == "k"