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

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

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

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

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

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

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

j.u = k
j.p = f
i.q = d
i.p = d
e.u = f
k.o = f
k.u = f
k.w = f
k.v = e
k.p = e
k.x = d
f.s = i
d.p = f
d.t = f
d.s = i
d.x = j
d.z = e
assert j.p.s.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

j.u = k
j.p = f
i.q = d
i.p = d
e.u = f
k.o = f
k.u = f
k.w = f
k.v = e
k.p = e
k.x = d
f.s = i
d.p = f
d.t = f
d.s = i
d.x = j
d.z = e
assert j.p.s.p.x.txt == "j"