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

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

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

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

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

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

e = A("e")
c = B("c")
l = C("l")
d = D("d")
h = E("h")
j = F("j")

e.o = j
e.u = j
e.x = c
e.t = l
e.p = l
e.q = h
c.r = d
c.o = h
l.o = e
l.w = h
l.s = c
d.q = h
h.q = d
j.r = d
assert j.r.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: B = None
        self.t: C = None
        self.u: F = None
        self.p: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

e = A("e")
c = B("c")
l = C("l")
d = D("d")
h = E("h")
j = F("j")

e.o = j
e.u = j
e.x = c
e.t = l
e.p = l
e.q = h
c.r = d
c.o = h
l.o = e
l.w = h
l.s = c
d.q = h
h.q = d
j.r = d
assert j.r.q.q.q.txt == "h"