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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: E = None
        self.t: B = None
        self.w: D = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

b = A("b")
a = B("a")
e = C("e")
g = D("g")
c = E("c")
d = F("d")
i = C("i")

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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: E = None
        self.t: B = None
        self.w: D = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

b = A("b")
a = B("a")
e = C("e")
g = D("g")
c = E("c")
d = F("d")
i = C("i")

b.p = a
b.w = a
b.q = d
b.s = g
b.y = e
b.t = c
a.r = i
a.x = b
a.p = b
a.t = c
e.u = i
e.z = c
e.y = c
e.t = a
e.w = g
e.o = b
g.x = c
g.z = c
c.p = g
c.w = g
d.v = g
i.u = e
i.z = c
i.y = c
i.t = a
i.w = g
i.o = b
assert a.p.w.r.w.x.w.z.txt == "c"