class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: F = None
        self.w: C = None
        self.v: F = None
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: F = None
        self.w: D = None
        self.u: F = None
        self.r: A = None
        self.v: B = None
        self.p: D = 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.x: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: F = None
        self.w: D = None
        self.u: F = None
        self.r: A = None
        self.v: B = None
        self.p: D = 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.x: A = None
        self.txt = txt

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

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

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

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