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

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

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

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

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

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

e = A("e")
j = B("j")
b = C("b")
i = D("i")
c = E("c")
k = F("k")

e.p = c
e.w = c
e.u = c
e.x = b
j.s = i
b.u = i
b.o = k
i.s = j
c.o = j
c.s = k
c.w = e
k.p = j
k.s = i
assert e.x.u.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: C = None
        self.w: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

e = A("e")
j = B("j")
b = C("b")
i = D("i")
c = E("c")
k = F("k")

e.p = c
e.w = c
e.u = c
e.x = b
j.s = i
b.u = i
b.o = k
i.s = j
c.o = j
c.s = k
c.w = e
k.p = j
k.s = i
assert e.x.u.s.s.s.txt == "j"