class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: E = None
        self.w: E = None
        self.t: G = None
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.z: G = None
        self.r: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: A = None
        self.z: D = None
        self.w: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

m = A("m")
f = B("f")
l = C("l")
i = D("i")
j = E("j")
c = F("c")
h = G("h")

m.p = h
m.t = h
m.u = j
m.w = j
m.q = c
f.o = j
l.q = j
l.p = i
i.u = c
i.z = f
i.x = j
j.y = h
j.z = h
j.r = c
c.u = l
c.v = l
c.t = f
c.r = j
c.x = m
h.v = i
h.z = i
h.o = i
h.r = i
h.x = m
h.w = m
assert m.q.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: E = None
        self.w: E = None
        self.t: G = None
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.z: G = None
        self.r: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: A = None
        self.z: D = None
        self.w: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

m = A("m")
f = B("f")
l = C("l")
i = D("i")
j = E("j")
c = F("c")
h = G("h")

m.p = h
m.t = h
m.u = j
m.w = j
m.q = c
f.o = j
l.q = j
l.p = i
i.u = c
i.z = f
i.x = j
j.y = h
j.z = h
j.r = c
c.u = l
c.v = l
c.t = f
c.r = j
c.x = m
h.v = i
h.z = i
h.o = i
h.r = i
h.x = m
h.w = m
assert m.q.u.p.txt == "i"