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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: D = None
        self.txt = txt

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

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