class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.z: E = None
        self.u: F = None
        self.x: B = None
        self.v: D = None
        self.w: B = None
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: E = None
        self.txt = txt

c = A("c")
f = B("f")
m = C("m")
l = D("l")
n = E("n")
d = F("d")
i = G("i")
g = H("g")

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: E = None
        self.txt = txt

c = A("c")
f = B("f")
m = C("m")
l = D("l")
n = E("n")
d = F("d")
i = G("i")
g = H("g")

c.p = m
c.r = l
c.v = l
c.z = n
c.o = n
c.u = d
c.x = f
c.w = f
f.o = g
f.y = g
f.s = c
m.s = d
m.w = l
l.p = c
l.r = n
l.s = f
l.w = m
l.v = d
n.r = c
n.z = f
d.q = g
i.v = n
g.z = c
g.x = n
assert f.y.x.r.p.txt == "m"