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

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

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

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

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

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

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

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

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

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

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

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

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

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

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