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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
g = C("g")
a = D("a")
j = E("j")
c = F("c")
m = A("m")

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
g = C("g")
a = D("a")
j = E("j")
c = F("c")
m = A("m")

d.p = n
d.r = c
d.s = c
d.w = j
d.o = j
d.x = g
n.z = c
n.s = c
n.r = j
g.w = j
a.z = j
j.u = c
j.o = g
j.r = g
j.v = g
j.p = n
c.u = d
m.p = n
m.r = c
m.s = c
m.w = j
m.o = j
m.x = g
assert g.w.r.w.u.u.s.u.txt == "d"