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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.txt = txt

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

i.p = a
i.x = a
i.w = e
i.s = c
i.r = j
a.y = f
a.z = c
f.s = e
f.w = e
f.x = h
f.r = c
f.o = i
j.t = a
j.u = i
e.u = h
e.y = a
e.p = a
m.r = f
m.v = c
c.p = a
c.x = a
c.w = e
c.s = h
c.r = j
h.p = a
h.x = a
h.w = e
h.s = i
h.r = j
assert c.x.y.w.y.z.w.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.w: E = None
        self.s: A = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.txt = txt

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

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