class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.u: B = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: B = None
        self.o: E = None
        self.txt = txt

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

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