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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.y: E = None
        self.w: 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.v: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
c = D("c")
f = E("f")
d = F("d")

i.p = d
i.u = d
i.o = m
i.v = f
g.o = i
g.v = i
g.y = f
g.w = d
m.u = f
c.v = i
f.w = c
f.o = m
d.t = i
assert d.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: C = None
        self.u: F = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.y: E = None
        self.w: 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.v: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
c = D("c")
f = E("f")
d = F("d")

i.p = d
i.u = d
i.o = m
i.v = f
g.o = i
g.v = i
g.y = f
g.w = d
m.u = f
c.v = i
f.w = c
f.o = m
d.t = i
assert d.t.u.t.txt == "i"