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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.r: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: A = None
        self.r: C = None
        self.q: E = None
        self.txt = txt

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

a.u = g
a.t = f
c.t = f
c.o = g
j.q = f
j.r = f
j.x = g
g.s = j
g.y = f
e.s = g
f.y = g
f.o = a
f.r = j
f.q = e
assert g.y.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.r: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: A = None
        self.r: C = None
        self.q: E = None
        self.txt = txt

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

a.u = g
a.t = f
c.t = f
c.o = g
j.q = f
j.r = f
j.x = g
g.s = j
g.y = f
e.s = g
f.y = g
f.o = a
f.r = j
f.q = e
assert g.y.o.u.txt == "g"