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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: D = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.r: A = None
        self.x: F = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

f = A("f")
d = B("d")
a = C("a")
g = D("g")
n = E("n")
b = F("b")
j = D("j")

f.v = j
f.p = b
d.u = n
a.v = d
a.o = j
a.t = j
a.p = n
g.q = d
g.t = d
g.r = f
g.p = f
g.x = b
n.q = b
b.y = n
j.q = d
j.t = d
j.r = f
j.p = f
j.x = b
assert f.v.q.u.q.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: D = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.r: A = None
        self.x: F = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

f = A("f")
d = B("d")
a = C("a")
g = D("g")
n = E("n")
b = F("b")
j = D("j")

f.v = j
f.p = b
d.u = n
a.v = d
a.o = j
a.t = j
a.p = n
g.q = d
g.t = d
g.r = f
g.p = f
g.x = b
n.q = b
b.y = n
j.q = d
j.t = d
j.r = f
j.p = f
j.x = b
assert f.v.q.u.q.y.q.txt == "b"